package com.zhongyi.controller;

import com.zhongyi.domain.Account;
import com.zhongyi.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class HelloController {

    @RequestMapping(path = "/hello")
    public String sayHello(){
        System.out.println("hello world");
        return "success";
    }

    @RequestMapping(path = "/user/hello",method = {RequestMethod.GET},params = {"username"})
    public String testRequeatMapping(){
        System.out.println("requestmapping test...");
        return "success";
    }

    @RequestMapping("/params/saveAccount")
    public String test(Account account){
        System.out.println(account);
        return "success";
    }

    @RequestMapping("/params/saveUser")
    public String saveUser(String[] userName,User user){
        System.out.println(userName);
        System.out.println(user);
        return "success";
    }

    @RequestMapping("/params/CookieId")
    public String getCookieId(@CookieValue("JSESSIONID") String cookie){
        System.out.println(cookie);
        return "success";
    }


}
